import React, {Component} from 'react';
import {CSSTransition} from "react-transition-group";
import './style.css'

class IndexVideo extends Component {
    constructor(props) {
        super(props);
        this.state = {
            hidden: true
        }
    }

    change = function () {
        const {hidden} = this.state;
        this.setState({
            hidden: !hidden
        })
    };
    render() {
        return (
            <div>
                <button onClick={e => this.change()}>切换</button>
                <div>
                    <CSSTransition classNames='why' in={!this.state.hidden} timeout={500} unmountOnExit={true}
                        onEnter={() => console.log('进入动画')}
                                   onEntering={() => console.log("进入中")}

                    >
                        <span>我展示了</span>
                    </CSSTransition>
                </div>
            </div>
        );
    }
}

IndexVideo.propTypes = {};

export default IndexVideo;